<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="js/vue.js"></script>
</head>
<body>
    <div id="app">
       <p ref="hello">{{ msg }}</p>
       <div ref="world">哈哈哈哈</div>

       <button @click="show()">按钮</button>
       <hr>

       <button @click="changeMsg">修改msg</button>
    </div>
</body>
</html>
<script>
    var vm = new Vue({
        // el: '#app',
        data: { 
           msg: 'welcome'
        },
        methods: {
            show(){
                console.log(this.$refs.world)
            },
            changeMsg(){
                this.msg = '欢迎您'
                // 此时DOM还没更新，需要时间来更新页面
                this.$nextTick(function(){
                    console.log(this.$refs.hello.innerText)
                })
            }
        }
    }).$mount('#app')

    // console.log(vm.$el)
    // console.log(vm.$refs.world)


    // vm.$mount('#app')
    
</script>